/*
 * JSFunctionAdapter.java - ScriptME
 * 
 * Copyright (c) 2009 Cesar Henriques <cesar at alttab.com.ar>.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Based on FESI Project
 * 
 * Contributors:
 * 	Jean-Marc Lugrin - initial API and implementation
 * 	Cesar Henriques <cesar at alttab.com.ar> - J2ME Porting and Extensions
 */
package org.scriptme.ecmascript.jslib;

/**
 * Implements a default class to ease the implementation of function objects.
 */
public class JSFunctionAdapter implements JSFunction {

	/**
	 * Call the specified EcmaScript method of this object.
	 * 
	 * @param thisObject
	 *            the this object
	 * @param args
	 *            the args
	 * 
	 * @return The result of the evaluation
	 * 
	 * @throws JSException
	 *             the JS exception
	 * 
	 * @exception JSException
	 *                For any error during interpretation
	 */
	public Object doCall(JSObject thisObject, Object args[]) throws JSException {
		throw new JSException("No function defined for this object");
	}

	/**
	 * Create a new object, using the specified EcmaScript method of this
	 * object.
	 * 
	 * @param thisObject
	 *            the this object
	 * @param args
	 *            the args
	 * 
	 * @return The result of the evaluation
	 * 
	 * @throws JSException
	 *             the JS exception
	 * 
	 * @exception JSException
	 *                For any error during interpretation
	 */
	public Object doNew(JSObject thisObject, Object args[]) throws JSException {
		throw new JSException("No constructor defined for this object");
	}
}
